package com.weiaibenpao.demo.chislim.retrofit.rx;

import com.weiaibenpao.demo.chislim.retrofit.model.BaseResponse;

/**
 * Created by wlx on 2017/12/6.
 */

public class APIException extends Exception {
    private int code;
    private String msg;
    private BaseResponse mBaseResponse;

    public APIException(int code, String message) {
        this.code = code;
        this.msg = message;
    }

    public APIException(BaseResponse baseResponse) {
        this.mBaseResponse = baseResponse;
        this.code = baseResponse.getCode();
        this.msg = baseResponse.getMessage();
    }

    public int getCode() {
        return code;
    }

    public BaseResponse getBaseResponse() {
        return mBaseResponse;
    }

    @Override
    public String getMessage() {
        return msg;
    }
}
